package cn.chencaiju.App;

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Panel;
import java.awt.Window;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class TankGame extends Frame {
	public void showFrame() {
		setBackground(Color.gray);
		setTitle("tankgame");
		setResizable(true);
		setVisible(true);
		setSize(514, 450);
		setLayout(new FlowLayout());
		li l=new li();
		this.addWindowListener(l);
	}

	public static void main(String[] args) {
		TankGame tankgame=new TankGame();
		tankgame.showFrame();
		TankGameTwo tankgametwo=new TankGameTwo();
		tankgametwo.showPanel();
		tankgame.add(tankgametwo);
		
	}

}
class TankGameTwo extends Panel{
	void showPanel(){
		setBackground(Color.black);
		setSize(415,415);
		setBounds(35, 38, 415, 415);
		setVisible(true);
		setLayout(null);
	}
}

//关闭窗口
class li extends  WindowAdapter{
    public void windowClosing(WindowEvent e){
     Window i=(Window)e.getWindow();
     i.setVisible(false);
     System.exit(-1);
    }
}
